
<style lang="less" scoped>

</style>

<template>
  <div style="padding-top: 20px;">
    <div align="center">
      <h1>问题列表</h1>
    </div>

    <div>
      <Scroll height="700">
        <div v-for='request in allRequestList' style="background:#eee;padding: 20px">
          <Card  :bordered="false">
            <p slot="title">{{request.title}}</p>
            <div v-html="request.content" @click="gotoAnswer(request.tid)"></div>
          </Card>
        </div>
      </Scroll>
    </div>
  </div>
</template>
<script>
import httpUtil from '@/libs/httpUtil'

export default {
  name: 'RequestList',
  components: {

  },
  data () {
    return {
      // 所有问题列表
      allRequestList: []

    }
  },
  methods: {

    handleSubmit (name) {
      this.$httpUtil.asyncPost('request_answer/request/save',
        this.requestForm,
        res => {
          this.$Message.success(res.data.msg)
        })
    },

    // 跳转到回答页面
    gotoAnswer (requestId) {
      // this.$router.push({name:'answer',params:{'requestId': requestId}});
      this.$Message.info(requestId)
      this.$router.push({path: '/answer/' + requestId})
    },

    // 获取数据全部问题的数据
    getAllRequest () {
      this.$httpUtil.asyncGet('request_answer/request/query', {}, res => {
        this.$Message.info(res.data.msg)
        if (res.data.code === 200) {
          this.allRequestList = res.data.records
        }
      })
    },

    // 页面初始化方法
    init () {
      this.getAllRequest()
    }

  },
  mounted: function () {
    this.init() // 页面初始化
  }
}
</script>
